#include("/template/common/layout/_page_layout.html")
#@layout()

#define css()
<style>

</style>
#end

#define js()
<script type="text/javascript">
    layui.use(['table', 'layer'], function () {
        var table = layui.table
            , layer = layui.layer
            , $ = layui.jquery
            , form = layui.form;

        // 表格渲染
        var tableIns = table.render({
            elem: '#dateTable'                  //指定原始表格元素选择器（推荐id选择器）
            , id: 'dateTable'
            , even: true //开启隔行背景
            , size: 'sm' //小尺寸的表格
            , height: 'full-140'    //容器高度
            , cols: [[                  //标题栏
                {type: 'numbers', fixed: true, unresize: true}
                , {field: 'name', title: '申请人', minWidth: 150,sort:true}
                , {field: 'roleId', title: '申请角色权限', minWidth: 120,sort:true, templet: '#statusTpl(roleStatus, "roleId")'}
                , {field: 'reply', title: '回复信息', minWidth: 150}
                , {field: 'lastUpdTime', title: '最后更新时间', width: 150,sort:true}
                , {field: 'status', title: '状态', minWidth: 100, sort:true,
                    templet: '#statusTpl(io.jboot.admin.service.entity.status.system.AuthStatus::me(), "status")'}
                , {fixed: 'right', title: '操作', minWidth: 200, align: 'center', toolbar: '#barOption'} //这里的toolbar值是模板元素的选择器
            ]]
            , url: '#(ctxPath)/system/projectauth/verifyTableData'
            , method: 'get'
            , request: {
                pageName: 'pageNumber' //页码的参数名称，默认：page
                , limitName: 'pageSize' //每页数据量的参数名，默认：limit
            }
            , page: true
            , limits: [30, 60, 90, 150, 300]
            , limit: 30 //默认采用30
            , loading: true
            , done: function (res, curr, count) {
            }
        });

        table.on('tool(dateTable)', function (obj) {
            var data = obj.data;
            if (obj.event === 'edit') {
                pop_show('审核结果', '#(ctxPath)/system/projectauth/verifyUpdate?id=' + data.id, '440', '265', function () {
                    reloadTable(null, null, null, null);
                });
            } else if (obj.event === 'view') {
                pop_max_show('认证信息', '#(ctxPath)/system/projectauth/verifyView?id=' + data.id, '440', '265', function () {
                });
            } else if (obj.event === 'warning') {
                layer.confirm('该认证已审核，确定要重新审核', function (index) {
                    pop_show('审核结果', '#(ctxPath)/system/projectauth/verifyUpdate?id=' + data.id, '440', '265', function () {
                        reloadTable(null, null, null, null);
                        layer.close(index);
                    });
                });
            }


        });

        $("#back").click(function () {
            window.location.href = '#(ctxPath)/system/projectauth/index';
        });


        reloadTable = function (_name, _type, _userId, _status) {
            table.reload('dateTable', {
                url: '#(ctxPath)/system/projectauth/verifyTableData'
                , where: {
                    name: _name,
                    type: _type,
                    userId: _userId,
                    status: _status
                } //设定异步数据接口的额外参数
            });
        };


        form.on('submit(search)', function (data) {
            reloadTable(data.field.name, data.field.type, null, data.field.status);
            return false; //阻止表单跳转。如果需要表单跳转，去掉这段即可。
        });
    });


</script>
#end

#define content()
<div class="layui-fluid">
    <form id="searchForm" class="layui-form x-center" action="">
        <div class="layui-form-pane">
            <div class="layui-form-item">

                <label class="layui-form-label">状态</label>
                <div class="layui-input-inline">
                    <select id='status' name="status">
                        <option></option>
                        #statusOption(io.jboot.admin.service.entity.status.system.AuthStatus::me())
                    </select>
                </div>


                <label class="layui-form-label">申请人</label>
                <div class="layui-input-inline">
                    <input type="text" id="name" name="name" placeholder="申请人" class="layui-input"/>
                </div>
                <div class="layui-input-inline" style="width : 80px">
                    <button class="layui-btn" lay-submit="" lay-filter="search"><i class="layui-icon">&#xe615;</i>
                    </button>
                </div>
            </div>
        </div>
    </form>
    <div class="layui-row">
        <table id="dateTable" lay-filter="dateTable"></table>
    </div>
    <div class="layui-layer-btn-c">
        <button id="back" class="layui-btn layui-btn-small ">返回</button>
    </div>
</div>

<script type="text/html" id="barOption">

    #shiroHasPermission('/system/projectauth/verifyView')
    <a class="layui-btn layui-btn-xs" lay-event="view">查看</a>
    #end
    #shiroHasPermission('/system/projectauth/verifyUpdate')
    #[[
    {{#  if(d.status == '3'){ }}
    ]]#

    <a class="layui-btn layui-btn-warm layui-btn-xs" lay-event="edit">审核</a>

    #[[
    {{#  } }}
    ]]#
    #end
</script>
#end